package lzzy;
import lzzy.Circle;
import lzzy.GeometricObject;
import lzzy.Rectangle;
public class BoundedTypeDemo {
    public static void main(String[] args) {
        Rectangle rectangle = new Rectangle(2,2);
        Circle circle = new Circle(2);
        Ellipse ellipse = new Ellipse(4,5);

        System.out.println("Same area? " + equalArea(rectangle,circle));
        System.out.println("Same perimeter? " + perimeter(rectangle,circle));
        // 比较椭圆和圆的面积和周长
        System.out.println("椭圆和圆的面积相等吗？" + equalArea(ellipse,circle));
        System.out.println("椭圆和圆的周长相等吗？" + perimeter(ellipse,circle));

    }

    private static <E extends GeometricObject> boolean equalArea(E object1, E object2) {
        return object1.getArea() == object2.getArea();
    }

    private static <E extends GeometricObject> boolean perimeter(E object1,E object2){
        return object1.getPerimeter() == object2.getPerimeter();
    }
}
